package org.sdp.pearproject.service.impl;


import java.util.ArrayList;
import java.util.List;
import java.util.Set;

import org.sdp.pearproject.dto.request.*;
import org.sdp.pearproject.dto.response.*;
import org.sdp.pearproject.dao.domain.*;
import org.sdp.pearproject.service.*;
import org.sdp.pearproject.service.custom.*;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;

/**
 * @ClassName: EventsMemberServiceImpl
 * @Description:
 * @Author: SDP
 * @Date: 2022-08-05
 * @Version: 1.0
 * Table: pear_events_member
 * Comment:
 * 日程-成员表
 */
@Service
public class EventsMemberServiceImpl extends EventsMemberServiceCustomImpl implements EventsMemberService {

    static {
        beanClassNameMap.put("events_member", "eventsMemberServiceImpl");
        listMethodNameMap.put("events_member", "listEventsMember");
        listMethodParameterClassNameMap.put("events_member", "EventsMemberQueryRequest");
        updateMethodNameMap.put("events_member", "updateEventsMember");
        updateMethodParameterClassNameMap.put("events_member", "EventsMemberUpdateRequest");
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public Integer addEventsMember(EventsMemberAddRequest request) throws Exception {
        super.fixRequest("events_member", "add", request);
        return super.addEventsMember(request);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public Integer updateEventsMember(EventsMemberUpdateRequest request) throws Exception {
        EventsMember record = null;
        record = eventsMemberMapper.selectByPrimaryKey(request.getId());
        super.fixRequest("events_member", "update", request, record);
        return super.updateEventsMember(request);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public Integer deleteEventsMember(EventsMemberDeleteRequest request) throws Exception {
        if (needCheckDeleteList(request)) {
            List<EventsMember> list = null;
            EventsMemberExample example = new EventsMemberExample();
            example.createCriteria().andIdIn(request.getIdList());
            list = eventsMemberMapper.selectByExample(example);
            fixRequest("events_member", "delete", request, list);
        } else {
            fixRequest("events_member", "delete", request);
        }
        return super.deleteEventsMember(request);
    }

    @Override
    public EventsMemberQueryResponse queryEventsMember(EventsMemberQueryRequest request) throws Exception {
        super.checkNonNull(request.getId(), "id");
        EventsMemberQueryResponse result = super.queryEventsMember(request);
        checkResult("events_member", "query", request, result);
        return result;
    }

    @Override
    public List<EventsMemberQueryResponse> listEventsMember(EventsMemberQueryRequest request) throws Exception {
        List<EventsMemberQueryResponse> list = super.listEventsMember(request);
        checkResult("events_member", "list", request, list);
        return list;
    }

    @Override
    public Integer countEventsMember(EventsMemberQueryRequest request) throws Exception {
        clearPageInfo(request);
        super.fixRequest("events_member", "count", request);
        return super.countEventsMember(request);
    }

    @Override
    public BaseStatResponse statEventsMember(EventsMemberQueryRequest request) throws Exception {
        clearPageInfo(request);
        super.fixRequest("events_member", "stat", request);
        return super.statEventsMember(request);
    }

}
